package list;

public class AdjacencyListNode extends DListNode {
	
	protected AdjacencyListNode partner;
	
	/**
	 * AdjacencyListNode constructor
	 * Also sets the partner field to itself or "this"
	 * @param i the item of the node
	 * @param l	the list the node belongs to
	 * @param p	the previous node of this node
	 * @param n the next node of this node
	 */
	AdjacencyListNode(Object i, AdjacencyList l, AdjacencyListNode p, AdjacencyListNode n) {
		super(i, l, p, n);
		partner = this;
	}
	
	/**
	 * Sets partner field to the partner argument
	 * @param partner the node that is a partner of "this" node.
	 */
	public void setPartner(AdjacencyListNode partner) {
		this.partner = partner;
	}
	
	/**
	 * Gets partner of "this" node.
	 * @return the partner of "this" node.
	 */
	public AdjacencyListNode getPartner() {
		return partner;
	}
	
	/**
	 * Gets the list that "this" node belongs to.
	 * @return an AdjacencyList that "this" node belongs to.
	 */
	public AdjacencyList getList() {
		return (AdjacencyList) myList;
	}
}
